package site.wanjiahao;

import site.wanjiahao.client.FetchFileHttpRequest;
import site.wanjiahao.client.FetchFileMetaDataHttpRequest;
import site.wanjiahao.client.UploadFileHttpRequest;

import java.io.File;
import java.io.IOException;

public class MainTest {

    public static void main(String[] args) throws Exception {
        test3();

    }

    private static void test3() throws Exception {
        String url = "http://localhost:8080/upload";
        UploadFileHttpRequest uploadFileHttpRequest = new UploadFileHttpRequest(url);
        uploadFileHttpRequest.addFileParameter("file", new File(
                "D:\\软件\\简历.pdf"));
        uploadFileHttpRequest.process();
        System.out.println(uploadFileHttpRequest.getUUID());
    }

    private static void test2() throws IOException {
        String url = "http://localhost:8080/fetch/2ef87beaf5c04cdf9ba2271944664751";
        String property = System.getProperty("user.dir");
        File file = new File(property + "/src/main/resources/fetch");
        FetchFileHttpRequest fetchFileHttpRequest = new FetchFileHttpRequest(file, url);
        fetchFileHttpRequest.process();
    }

    private static void test1() throws IOException {
        String url = "http://localhost:8080/fetch_metadata/2ef87beaf5c04cdf9ba2271944664751";
        FetchFileMetaDataHttpRequest getFileMetaDataRequest = new FetchFileMetaDataHttpRequest(url);
        getFileMetaDataRequest.process();
        System.out.println(getFileMetaDataRequest.getEntity());
    }

}
